﻿@model CourseInfo
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>精品课程管理-新建课程</title>
    @Html.Partial("~/Views/Share/PublicHeader.cshtml")
    <link href="~/Css/uploadify.css" rel="stylesheet" />
</head>
<body>
     @Html.Partial("~/Views/Share/PublicTopNav2.cshtml")
        <div class="container">
            <div class="row">
                <h1 class="topTitle-h1">康复治疗微课程网络学习平台<br>
                    <small>广州中医药大学康复治疗微课程网络学习平台</small></h1>
            </div>
        </div>
        @*导航菜单*@
        @Html.Partial("~/Views/Share/PublicAdminNaviMenu.cshtml", 1)
        <div class="container">
            <div class="row">
                <div class="col-xs-2">
                    <div class="dropdown theme-dropdown clearfix">
                        <a id="dropdownMenu1" href="#" role="button" class="sr-only dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
                        <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
                            <li class="active" role="presentation">
                                <a role="menuitem" tabindex="-1" href="@Url.Action("CourseInfoList", "CourseInfo")">
                                    <span class="glyphicon glyphicon-list"></span>课程列表</a></li>
                            <li role="presentation" class="divider"></li>
                            <li role="presentation">
                                <a role="menuitem" tabindex="-1" href="@Url.Action("CourseInfoAdd", "CourseInfo")">
                                    <span class="glyphicon glyphicon-plus"></span>新建课程</a></li>
                        </ul>
                    </div>
                </div>
                <div class="col-xs-10">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">
                                <ol class="breadcrumb">
                                    <li>精品课程管理</li>
                                    <li class="active">编辑课程</li>
                                </ol>
                            </h3>
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <form id="frm" class="form-horizontal" role="form">
                                    <div class="form-group clearfix">
                                        @Html.Hidden("Id", Model.Id)
                                        <label class="control-label col-xs-2">课程名称：</label>
                                        <div class="col-xs-4">
                                            <input type="text" name="CourseName" value="@Model.CourseName" class="form-control input-md" placeholder="请输入课程名" />
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">课程类型：</label>
                                        <div class="col-xs-4">
                                            @Html.DropDownList("CourseType", CourseInfoManage.Instance.GetCourseType(Model.CourseType), new { @class = "form-control" })
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">学  分：</label>
                                        <div class="col-xs-4">
                                            <input type="text" name="CreditPoint" value="@Model.CreditPoint" class="form-control input-md" placeholder="请输入学分" />
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">课程简介图片：</label>
                                        <div class="col-xs-4">
                                            <input type="hidden" id="CourseIntroImageUrl" name="CourseIntroImageUrl" value="@Model.CourseIntroImageUrl" />
                                            <img src="@Model.CourseIntroImageUrl" id="CourseIntroImg" style="width: 390px; height: 260px" />
                                        </div>
                                        <div class="col-xs-4 reminder">建议分辨率390*260</div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2"></label>
                                        <div class="col-xs-9">
                                            <input type="file" name="CourseIntroImg_upload" id="CourseIntroImg_upload" />
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">课程简介：</label>
                                        <div class="col-xs-9">
                                            <textarea type="text" name="CourseIntro" class="form-control input-md" rows="5">@Model.CourseIntro</textarea>
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">教师简介图片：</label>
                                        <div class="col-xs-4">
                                            <input type="hidden" id="TeacherIntroImageUrl" name="TeacherIntroImageUrl" value="@Model.TeacherIntroImageUrl" />
                                            <img src="@Model.TeacherIntroImageUrl" id="TeacherIntroImg" style="width: 390px; height: 260px" />
                                        </div>
                                        <div class="col-xs-4 reminder">建议分辨率390*260</div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2"></label>
                                        <div class="col-xs-9">
                                            <input type="file" name="TeacherIntroImg_upload" id="TeacherIntroImg_upload" />
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">教师简介：</label>
                                        <div class="col-xs-9">
                                            <textarea type="text" name="TeacherIntro" class="form-control input-md" rows="5">@Model.TeacherIntro</textarea>
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">课程目标：</label>
                                        <div class="col-xs-9">
                                            <textarea type="text" name="CourseGoal" class="form-control input-md" rows="5">@Model.CourseGoal</textarea>
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">实验内容：</label>
                                        <div class="col-xs-9">
                                            <textarea type="text" name="ExperimentContent" class="form-control input-md" rows="5">@Model.ExperimentContent</textarea>
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">课程图片：</label>
                                        <div class="col-xs-4">
                                            <input type="hidden" id="ImageUrl" name="ImageUrl" value="@Model.ImageUrl" />
                                            <img src="@Model.ImageUrl" id="courseImg" style="width: 390px; height: 260px" />
                                        </div>
                                        <div class="col-xs-4 reminder">建议分辨率390*260</div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2"></label>
                                        <div class="col-xs-9">
                                            <input type="file" name="file_upload" id="file_upload" />
                                        </div>
                                    </div>
                                    <div class="form-group clearfix"> 
                                        <div class="col-xs-offset-2 col-xs-10">
                                            <button type="button" onclick="autoSubmit('frm');" class="btn btn-success btn-md"><span class="glyphicon glyphicon-ok"></span>保存 </button>
                                            <button type="button" onclick="history.go(-1)" class="btn btn-success btn-md"><span class="glyphicon glyphicon-arrow-left"></span>返回</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        @Html.Partial("~/Views/Share/PublicFooter.cshtml")
        @Html.Partial("~/Views/Share/PublicCommonJs.cshtml")

    <script src="~/Content/jquery.form.js"></script>
    <script type="text/javascript" src=@Url.Content("~/Content/uploadify/jquery.uploadify.min.js?ver=")@DateTime.Now.Ticks></script>
    <script>
        $(function () {
            $("#file_upload").uploadify({
                'queueSizeLimit': 1,
                'formData': { 'fileType': 'OtherFile' },
                'buttonText': '请选择课程图片',
                'swf': '@Url.Content("~/Content/uploadify/uploadify.swf")',
                'uploader': '@Url.Action("Upload", "Base")',
                'onUploadSuccess': function (file, data, response) {
                    var json = $.parseJSON(data);
                    if (json.result) {
                        var _imgUrl = "../" + json.message;
                        $("#ImageUrl").val(_imgUrl);
                        $("#courseImg").attr("src", _imgUrl);
                    }
                }
            });
        });

        $("#CourseIntroImg_upload").uploadify({
            'queueSizeLimit': 1,
            'formData': { 'fileType': 'OtherFile' },
            'buttonText': '请选择课程简介图片',
            'swf': '@Url.Content("~/Content/uploadify/uploadify.swf")',
            'uploader': '@Url.Action("Upload", "Base")',
            'onUploadSuccess': function (file, data, response) {
                var json = $.parseJSON(data);
                if (json.result) {
                    var _imgUrl = "../" + json.message;
                    $("#CourseIntroImageUrl").val(_imgUrl);
                    $("#CourseIntroImg").attr("src", _imgUrl);
                }
            }
        });


        $("#TeacherIntroImg_upload").uploadify({
            'queueSizeLimit': 1,
            'formData': { 'fileType': 'OtherFile' },
            'buttonText': '请选择教师简介图片',
            'swf': '@Url.Content("~/Content/uploadify/uploadify.swf")',
            'uploader': '@Url.Action("Upload", "Base")',
            'onUploadSuccess': function (file, data, response) {
                var json = $.parseJSON(data);
                if (json.result) {
                    var _imgUrl = "../" + json.message;
                    $("#TeacherIntroImageUrl").val(_imgUrl);
                    $("#TeacherIntroImg").attr("src", _imgUrl);
                }
            }
        });







        var t = true;
        function autoSubmit(frmId) {
            var postData = $("#" + frmId).formSerialize();
            var url = "@Url.Action("CourseInfoEdit", "CourseInfo")";
            var options = {
                type: 'POST',
                data: postData,
                url: url,
                async: false,
                cache: false,
                success: function (data) {
                    if (data.result) {
                        showTips.open("编辑成功");
                    }
                    else {
                        showTips.open(data.message);
                    }
                }
            }
            if (t) {
                t = false;
                $.ajax(options);
                t = true;
            }
        };






    </script>
</body>
</html>


